package bid.entity;

import java.util.ArrayList;
import java.util.List;

/**
 * 分页类
 *
 * @author oldliu
 * @since 1.0
 */
public class Page<T> {
    //页号
    private int pageNo = 1;
    public static final int PAGESIZE = 10;//每页默认的行数
    //页大小
    private int pageSize = PAGESIZE;
    private long total;//所有的行
    private long pageNums;//所有的页数
    private List<T> data = new ArrayList<>(0);

    public Page() {

    }

    public Page(int pageNo, long total, List<T> data) {
        this.pageNo = pageNo;
        this.total = total;
        this.data = data;
        this.pageNums = this.total / this.pageSize + (this.total % this.pageSize == 0 ? 0 : 1);
    }

    public Page(int pageNo, int pageSize, long total, List<T> data) {
        this.pageNo = pageNo;
        this.pageSize = pageSize;
        this.total = total;
        this.data = data;
        this.pageNums = this.total / this.pageSize + (this.total % this.pageSize == 0 ? 0 : 1);
    }

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public long getTotal() {
        return total;
    }

    public void setTotal(long total) {
        this.total = total;
    }

    public long getPageNums() {
        return pageNums;
    }

    public void setPageNums(long pageNums) {
        this.pageNums = pageNums;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }
}
